Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sanitize-filename

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanitize-filename

Sanitize a string for use as a filename

  • 1.6.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is sanitize-filename?

The sanitize-filename npm package is designed to sanitize strings (especially filenames) to ensure they are safe for use within a filesystem. It removes or replaces invalid characters that could cause errors or security issues when used as filenames or paths.

What are sanitize-filename's main functionalities?

Sanitize filenames

This feature allows you to sanitize a string by removing or replacing characters that are not allowed in filenames across various operating systems. This is particularly useful for creating filenames from user input or external sources.

"const sanitize = require('sanitize-filename');\nconst title = 'My:Invalid/Filename*?<>|';\nconst safeTitle = sanitize(title);\nconsole.log(safeTitle); // Outputs 'MyInvalidFilename'"

Other packages similar to sanitize-filename

Keywords

FAQs

Package last updated on 26 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc